import React, { useState,useEffect } from 'react';
export default function Counter(props) {
    const [count, setCount] = useState(0);
    const [count2, setCount2] = useState(1);

    useEffect(() => {
        console.log('useEffect1',count);
        setCount2(count2 + 1);
    },[count])

    useEffect(() => {
        console.log('useEffect2',count,count2)
    },[count,count2])


    return (
        <div>
            <p>You clicked {count}</p>
            <p>You clicked {count2}</p>
            <button onClick={() => {console.log('count',count);setCount(count + 1)}}>
                Click me
            </button>
            <button onClick={() => {console.log('count2',count2);setCount2(count2 + 1)}}>
                Click me2
            </button>
        </div>
    );
}
